﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace BookSourceVerification.converter;

public class IsEnabledMultiValueConverter: IMultiValueConverter
{
    public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
    {
        if (values.Length != 2)
        {
            return false;
        }
        try
        {
            var count = (int)values[0];
            var enabled = (bool)values[1];
            return count > 0 && enabled;
        }
        catch (Exception)
        {
            return false;
        }
    }

    public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}